﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DataAccess;
using Entity;

namespace Bussiness
{
    public class AccountManager
    {
        public EAccount login(string name,string psw)
        {
            EAccount account=null; 
            AccountData ad = new AccountData();
            DataTable dt = ad.login(name,psw);           
            if (dt.Rows.Count > 0)
            {
                account = new EAccount(); 
                string userName = dt.Rows[0]["UserName"].ToString();
                string roleName = dt.Rows[0]["RoleName"].ToString();
                string authority = dt.Rows[0]["Authority"].ToString();
                account.UserName = userName;
                account.RoleName = roleName;
                account.Authoriry = authority;
            }            
            return account;
            
        }
    }
}
